<?php
if ($admin_value['admin_type'] == 'Web Admin' || $admin_value['admin_type'] == 'Sub Admin') {
	$this -> admin = 'admin';
} else {
	$this -> admin = 'panelist';
}
$this -> load -> view('admin/scoring/head');
?>
<body> 
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script type="text/javascript">
	function roundNumber(num, dec) {
		var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
		return result;
	}
	function UpdateInfo() {
		var citation_excluding_self = $('#citation_excluding_self').val();
		var journals_scopus = $('#journals_scopus').val();
		var journals_avcitationperpaper = roundNumber((parseInt(citation_excluding_self) / parseInt(journals_scopus)), 2);
		$('#journals_avcitationperpaper').val(journals_avcitationperpaper);
	}
	function InsertData(asd, name, value) {
		var a = value;
		$.ajax({
			type : "POST",
			url : 'http://mi5.com/index.php/admin/add_score',
			data : {
				xy : a,
				name : name
			},
			success : function(result) {

			}
		});
	}
</script>
<table id="TableMain" cellpadding="0" cellspacing="0" width="750px">
<?php if (isset($error)) { echo $error; }?>
	<tbody>
		<tr>
        	<td style="height: 85px;" id="AdjustHeaderHeight"></td>                
        </tr>
        <tr>
        	<td id="DuplicateScoreLine"><br><br><br><br><br><br><br><br></td>
        </tr>
        <tr>
        	<td>
            	<table id="TblAppContent" class="FormTable" border="0" cellpadding="2" cellspacing="2" width="1%">
                	<tbody>
                        <tr>
                        	<td>
                            	<div id="pnlList">                                   
                                    <table style="border: 1px solid #dddddd;" cellpadding="0" cellspacing="0">
                                        <tbody>
                                        	<tr>
                                            	<td>
                                                    <div id="divHeader" style="position: fixed; left: 0px; top: 0px; padding: 0px 0px 0px 8px; background-color: white;">
                                                    <div id="divLabelTop">
                                                    	<table id="tblLabel" border="0" cellpadding="0" cellspacing="0">
		                                                    <tbody>
		                                                    	<tr style="background-color: #ffffff;">
		                                                        	<td height="3px"></td>
		                                                    </tr>
		                                                    <tr style="background-color: #ffffff;">
		                                                        <td>
		                                                            <input class="B8" onClick="window.close();" value="Save &amp; Exit" type="button">
		                                                        </td>
		                                                    </tr>
		                                                    <tr style="background-color: #ffffff;">
		                                                        <td height="10px"></td>
		                                                    </tr>
		                                                    <tr style="background-color: #ffffff;">
		                                                        <td style="vertical-align: middle;font-size: 18px;color: #0072BC;">
		                                                             <?php if(isset($event_detail[0]['event_name']))echo $event_detail[0]['event_name']; ?> - <?php if(isset($event_detail[0]['award_name']))echo $event_detail[0]['award_name']; ?> | Admin Scoring
		                                                        </td>
		                                                    </tr>
		                                                    <tr style="background-color: #ffffff;">
		                                                        <td>
		                                                            <fieldset style="width: 95%">
		                                                                <legend><b>Scoring Guideline</b></legend>
		                                                                <?php
		                                                                	$count = count($all_criteria)-1; 
		                                                                	if(isset($all_criteria[$count]['award_criteria_value']) && $all_criteria[$count]['award_criteria_value'] =='Scoring');
																			{
																				echo $all_criteria[$count]['award_criteria_value'];
																			} 
		                                                                ?>		                                                                
		                                                            </fieldset>
		                                                        </td>
		                                                    </tr>
		                                                    <tr>
		                                                        <td style="background-color: #ffffff;">
		                                                            <table id="TableClone" cellpadding="4" cellspacing="1" width="100%">
		                                                            </table>
		                                                        </td>
		                                                    </tr>
		                                                	</tbody>
		                                               	</table>
                                                	</div>                                            
                                                	</div>
                                                    <table id="tblGrid" border="0" cellpadding="4" cellspacing="1" width="100%">
                                                    	<thead>
															<tr>
																<td><div id="divBlank"></div></td>
															</tr>
															<tr>
																<td class="Grid_HeaderGreen" rowspan="3">&nbsp; </td>
																<td colspan="3" class="Grid_Header" align="center"><b>Details of Applicants</b></td>
																<?php 
																	if(isset($all_criteria))
																	{
																		foreach($all_criteria as $temp)
																		{
																			$id = $temp['award_criteria_id'];
																			$col = 0;
																			foreach($all_criteria as $temp1)
																			{
																				if($temp1['award_criteria_parent_id'] == $id)
																				{
																					$col++;
																				}
																			}
																			if($temp['award_criteria_parent_id'] == '0' && $temp['award_criteria_label'] != 'Scoring')
																			{?>
																				<td colspan="<?php if($col!='0')echo $col;else echo '1'; ?>" class="Grid_HeaderGreen" align="center"><b><?php if(isset($temp['award_criteria_label']))echo $temp['award_criteria_label']; ?></b></td>
																			<?php }
																		}
																	}
																?>
															</tr>
															<tr>
																<td class="Grid_Header"><img src="Images/tran.gif" height="1"></td>
																<td colspan="2" class="Grid_Header">&nbsp; </td>
																<td colspan="50" class="Grid_Header">&nbsp; </td>
															</tr>
															<tr>
																<td class="Grid_Header"><b> <a id="Rpt_ctl00_LinkButton23" class="Header" href="">Name</a> </b></td>
																<td colspan="2" class="Grid_Header"><b> <b><a id="Rpt_ctl00_lnk" class="Header" href="">Dissertation Title</a> </b></b></td>
																<?php 
																	if(isset($all_criteria))
																	{
																		foreach($all_criteria as $temp)
																		{
																			$id = $temp['award_criteria_id'];
																			foreach($all_criteria as $temp1)
																			{
																				if($temp1['award_criteria_parent_id'] == $id)
																				{?>
																					<td class="Grid_HeaderGreen"><b><?php if(isset($temp1['award_criteria_label']))echo $temp1['award_criteria_label']; ?></b></td>
																				<?php }
																			}
																		}
																	}
																?>
															</tr>
														</thead>
                                                        <tbody>
                                                    	<?php $i=1; foreach($rows as $name): ?>
                                                        <tr>
											                <td valign="top">
                                                               <?php echo $i; ?> 
                                                               <input type="hidden" name="applicant_id_<?php echo $name['user_application_applicant_id']; ?>" id="applicant_id_<?php echo $name['user_application_applicant_id']; ?>" value="<?php echo $name['user_application_applicant_id']; ?>">
															   <input type="hidden" id="award_id_<?php echo $name['user_application_applicant_id']; ?>" name="award_id_<?php echo $name['user_application_applicant_id']; ?>" value="<?php echo $name['user_application_award_id']; ?>">
															</td>
                                                            <td>
                                                                <a href="javascript:void(0);" onclick="showDiv('div_<?php echo $name['user_application_applicant_id']; ?>')"><?php if(isset($name['user_application_field1']))echo $name['user_application_field1']; if(isset($name['user_application_field3']))echo ' '.$name['user_application_field3'];?></a>
                                                                <div id="div_<?php echo $name['user_application_applicant_id']; ?>" style="display: none">
                                                                    <br>
                                                                    <a href="#abc" onClick="openPopUp('http://yrae.elsevier.com/ApplicationFormView.aspx?appid=25479',800,600);">View Applicant Detail</a><br><br>
                                                                    <a href="#abc" onClick="openPopUp('/AwardMgmtAdminScore.aspx/../Files/1308090054064373135^^TRF-CHE13_Extended%20Form(Khamphee%20Karwan).doc',800,600)">Extended Application Form</a><br><br>
                                                                    
                                                                    
                                                                    <a href="#abc" onClick="openPopUp('/AwardMgmtAdminScore.aspx/../Files/1308090054064376955^^TRF-CHE13_List%20of%20Publications%20TRF_CHE13%20Grants(Khamphee%20Karwan).xls',800,600)">Social/Economic/Scientific Write-Up</a><br><br>
                                                                    <a href="#abc" onClick="openPopUp('/AwardMgmtAdminScore.aspx/../Files/1308090054064534944^^TRF-CHE13_writeup%20Form(Khamphee%20Karwan).doc',800,600)">List of Publications</a><br><br>
                                                                    <a href="#abc" onClick="openPopUp('/AwardMgmtAdminScore.aspx/../Files/130809005406453199^^Publications(Khamphee%20karwan).pdf',800,600)">PDF of Publications (Please submit only 4 best papers)</a><br><br>
                                                               </div>
                                                            </td>
                                                            <td colspan="2">
                                                                <?php echo $name['user_application_field46']; ?>
                                                            </td>
                                                            <?php 
																if(isset($all_criteria))
																{
																	foreach($all_criteria as $temp)
																	{
																		$id = $temp['award_criteria_id'];
																		foreach($all_criteria as $temp1)
																		{
																			if($temp1['award_criteria_parent_id'] == $id)
																			{?>
																				<td>
																					<input id="criteria_value_<?php echo $name['user_application_applicant_id']; ?>" name="criteria_value_<?php echo $name['user_application_applicant_id']; ?>" onBlur="InsertData('<?php echo $temp1['award_criteria_label']; ?>','<?php echo $temp['award_criteria_label']; ?>','<?php echo $name['user_application_applicant_id']; ?>','<?php echo $name['user_application_award_id']; ?>',this.value);"  value="" class="N2" maxlength="6" type="text">
																					<input type="hidden" name="criteria_label_<?php echo $name['user_application_applicant_id']; ?>"  id="criteria_label_<?php echo $name['user_application_applicant_id']; ?>" value="<?php echo $temp1['award_criteria_label']; ?>" />
																				</td>
																			<?php }
																		}
																	}
																}
															?>
                                                        </tr>
                                                    <?php $i++;
															endforeach;
														?>
                                                        </tbody></table>
                                            </td>
                                        </tr>
                                    </tbody></table>
								</div>
                            </td>
                        </tr>
                    </tbody></table>
                    <!--End: PanelistList-->
                </td>
            </tr>
            <tr>
                <td height="3">&nbsp;
                    
                </td>
            </tr>
            <tr>
                <td>
                    <a id="lnkExport" href="javascript:__doPostBack('lnkExport','')">Export to Excel</a>&nbsp;<img src="Images/icon_excel.gif" border="0">
                    <input name="Button2" value="Save &amp; Exit" onClick="window.close();" id="Button2" class="B8" type="submit">
					<?php echo form_close(); ?>
                </td>
            </tr>
            <tr>
                <td height="3px">
                </td>
            </tr>
        </tbody></table>
<?php echo form_open(BASE_URL . '/' . $this -> admin . '/admin_score', array('id' => 'score_form')); ?>
</body>
</html>